package 每日一题;

public class 范围求和2 {
    public int maxCount1(int m, int n, int[][] ops) {
        int a = m;
        int b = n;
        for (int[] op : ops) {
            a = Math.min(a,op[0]);
            b = Math.max(b,op[1]);
        }
        return a*b;
    }
    public int maxCount(int m, int n, int[][] ops) {
        int[][] ints = new int[m][n];
        for (int[] op : ops) {
            for (int i = 0; i < op[0]; i++) {
                for (int j = 0; j < op[1]; j++) {
                    ints[i][j]+=1;
                }
            }
        }
        int num = 0;
        for (int i = 0; i < m; i++) {
            for (int j = 0; j < n; j++) {
                if (ints[i][j]==ints[0][0])
                    num++;
            }
        }
        return num;
    }
}
